// directives/esc-close.js
export default {
  bind(el, binding, vnode) {
    const handler = (e) => {
      if (e.key === 'Escape') {
        binding.value();
      }
    };
    el._escHandler = handler;
    document.addEventListener('keydown', handler);
  },
  unbind(el) {
    document.removeEventListener('keydown', el._escHandler);
  }
};